import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/base/base_presenter.dart';
import 'package:flutter_app/base/base_state.dart';
import 'package:flutter_app/base/i_view.dart';
import 'package:flutter_app/res/colours.dart';
import 'package:flutter_app/utils/log_util.dart';
import 'package:sp_util/sp_util.dart';
import 'package:oktoast/oktoast.dart';
import '../constant.dart';

class UserCenterPage extends BaseFulWidget {
  @override
  State<StatefulWidget> createState() => _UserCenterState();
}

class _UserCenterState extends BaseState<BasePresenter, UserCenterPage>
    with AutomaticKeepAliveClientMixin {
  String userName = '';

  @override
  void initState() {
    super.initState();
    userName = SpUtil.getString(Constant.USER_NAME);
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
      child: Column(
        children: [
          Padding(
              padding: EdgeInsets.only(top: 80),
              child: Image.asset(
                'assets/images/splash.jpg',
                height: 100,
              )),
          Padding(padding: EdgeInsets.only(top: 10)),
          Text(userName, style: TextStyle(fontSize: 15, color: Colours.ff2c2c2c)),
          Padding(padding: EdgeInsets.only(top: 40)),
          Row(children: <Widget>[
            Padding(
                padding: EdgeInsets.all(15),
                child: Icon(Icons.account_balance_wallet_rounded)),
            Text('我的积分')
          ]),
          Row(children: <Widget>[
            Padding(padding: EdgeInsets.all(15), child: Icon(Icons.share)),
            Text('我的分享')
          ]),
          Row(children: <Widget>[
            Padding(
                padding: EdgeInsets.all(15),
                child: Icon(Icons.collections_bookmark)),
            Text('我的收藏')
          ]),
          Row(children: <Widget>[
            Padding(padding: EdgeInsets.all(15), child: Icon(Icons.history)),
            Text('阅读历史')
          ]),
          Row(children: <Widget>[
            Padding(
                padding: EdgeInsets.all(15),
                child: Icon(Icons.night_shelter_sharp)),
            Text('夜间模式')
          ]),
          Row(children: <Widget>[
            Padding(padding: EdgeInsets.all(15), child: Icon(Icons.upgrade)),
            Text('检查更新')
          ]),
          InkWell(
            onTap: () {
              showToast('关于我们');
            },
            child: Row(children: <Widget>[
              Padding(
                  padding: EdgeInsets.all(15),
                  child: Icon(Icons.account_box_outlined)),
              Text('关于我们')
            ]),
          )
        ],
      ),
    ));
  }

  @override
  BasePresenter<IView> createPresenter() => null;

  @override
  bool get wantKeepAlive => true;
}
